home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: rug.nl!root
- From: S.H.Grotenhuis@cpedu.rug.nl (Steven Grotenhuis)
- Subject: Re: BORLAND C++ 4.5 wont add .1 and .9
- Message-ID: <DM41Dn.4ty@rug.nl>
- Sender: root@rug.nl (Operator)
- Nntp-Posting-Host: slip.cpedu.rug.nl
- Organization: Rekencentrum der Rijksuniversiteit Groningen
- X-Newsreader: Forte Free Agent 1.0.82
- References: <corekinDLG8t4.3C5@netcom.com> <4e5njv$e9v@damon.irf.uni-dortmund.de>
- Date: Thu, 1 Feb 1996 18:39:00 GMT
-
- Experimenting with this problem leaned me this:
-
- #include <stdio.h>
- int one()
- { return 1;
- }
-
- void main()
- { int two;
- int zero=0;
- if (zero==0) {two=1+one();
- //two=two;
- }
-
- /*apparently it's not just the ? operator
- that causes trouble.
- applying this dummy-statement causes BC4.5
- to yield the expected result as well as replacing
- two=1+one(); with two=1+one()+one();
- */
-
- else two=zero+1;
-
- /*this is perhaps the strangest part of the
- bug: omitting the else-statement or replacing
- it by 'else two=zero+23;' or something also results
- in the correct output, eventhough 'tracing into'
- suggests that this statement is never reached.
- */
-
- printf("one() plus 1 is %d\n", two);
- }
-
- Has anyone tried the Microsoft compilers yet ?
-
- How about the certainty I relied on that malfunctioning programs are
- the programmer's responsability ?
- --
- Steven Grotenhuis
- Dauwtrappers inc.
-
-